﻿Public Class dati_stampa
    Public Shared Property file_origine As String
    Public Shared Property file_modificato As String
    Public Shared Property drawstate As String
    Public Shared Property qta_mag As String
    Public Shared Property Tempfile As String

    

    Private Sub dati_stampa_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Tbhtesto.Text = 20
        
        cliente = Tbcliente.Text
        colore = Tbcolore.Text
        htesto = Tbhtesto.Text
        odp = Tbodp.Text
        note = Tbnote.Text
        quantita = Tbquantita.Text
        abilitawatermark = True
        CbDestinazione.SelectedIndex = 0
    End Sub


    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        cliente = Tbcliente.Text
        colore = Tbcolore.Text
        htesto = Tbhtesto.Text
        odp = Tbodp.Text
        note = Tbnote.Text
        quantita = Tbquantita.Text
        If CbDestinazione.SelectedItem.ToString Is Nothing = False Then
            destinazione = CbDestinazione.SelectedItem.ToString
        End If
        file_modificato = crea_pdf(file_origine, drawstate, qta_mag, destinazione)

        'UserControl1.filesorgente.Text = file_modificato
        'UserControl1.filesorgente_TextChanged(Nothing, Nothing)

    End Sub

    Private Sub cburgente_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cburgente.CheckedChanged
        If cburgente.CheckState = CheckState.Checked Then
            urgente = True
            cliente = Tbcliente.Text
            colore = Tbcolore.Text
            htesto = Tbhtesto.Text
            odp = Tbodp.Text
            note = Tbnote.Text
            quantita = Tbquantita.Text
            file_modificato = crea_pdf(file_origine, drawstate, qta_mag)
            'UserControl1.filesorgente.Text = file_modificato
            'UserControl1.filesorgente_TextChanged(Nothing, Nothing)
        ElseIf cburgente.CheckState = CheckState.Unchecked Then
            urgente = False
            cliente = Tbcliente.Text
            colore = Tbcolore.Text
            htesto = Tbhtesto.Text
            odp = Tbodp.Text
            note = Tbnote.Text
            quantita = Tbquantita.Text
            file_modificato = crea_pdf(file_origine, drawstate, qta_mag)
            'UserControl1.filesorgente.Text = file_modificato
            'UserControl1.filesorgente_TextChanged(Nothing, Nothing)
        End If
    End Sub

    Private Sub cbmodifica_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbmodifica.CheckedChanged
        If cbmodifica.CheckState = CheckState.Checked Then
            abilitawatermark = False
            cliente = Tbcliente.Text
            colore = Tbcolore.Text
            htesto = Tbhtesto.Text
            odp = Tbodp.Text
            note = Tbnote.Text
            quantita = Tbquantita.Text
            file_modificato = crea_pdf(file_origine, drawstate, qta_mag)
            'UserControl1.filesorgente.Text = file_modificato
            ' UserControl1.filesorgente_TextChanged(Nothing, Nothing)
        ElseIf cbmodifica.CheckState = CheckState.Unchecked Then
            abilitawatermark = True
            cliente = Tbcliente.Text
            colore = Tbcolore.Text
            htesto = Tbhtesto.Text
            odp = Tbodp.Text
            note = Tbnote.Text
            quantita = Tbquantita.Text
            file_modificato = crea_pdf(file_origine, drawstate, qta_mag)
            'UserControl1.filesorgente.Text = file_modificato
            'UserControl1.filesorgente_TextChanged(Nothing, Nothing)
        End If
    End Sub

    Shared Sub RUN_PDF(ByVal DRAWSTATE As String, ByVal FILEORIGINE As String, ByVal QUANTITA_A_MAG As String)
       
        file_modificato = crea_pdf(FILEORIGINE, DRAWSTATE, QUANTITA_A_MAG)
        'UserControl1.filesorgente.Text = file_modificato
        'UserControl1.filesorgente_TextChanged(Nothing, Nothing)
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        posy -= 20
        cliente = Tbcliente.Text
        colore = Tbcolore.Text
        htesto = Tbhtesto.Text
        odp = Tbodp.Text
        note = Tbnote.Text
        quantita = Tbquantita.Text
        file_modificato = crea_pdf(file_origine, drawstate, qta_mag)
        'UserControl1.filesorgente_TextChanged(Nothing, Nothing)
    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        posy += 20
        cliente = Tbcliente.Text
        colore = Tbcolore.Text
        htesto = Tbhtesto.Text
        odp = Tbodp.Text
        note = Tbnote.Text
        quantita = Tbquantita.Text
        file_modificato = crea_pdf(file_origine, drawstate, qta_mag)
        'UserControl1.filesorgente_TextChanged(Nothing, Nothing)
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        posx += 20
        cliente = Tbcliente.Text
        colore = Tbcolore.Text
        htesto = Tbhtesto.Text
        odp = Tbodp.Text
        note = Tbnote.Text
        quantita = Tbquantita.Text
        file_modificato = crea_pdf(file_origine, drawstate, qta_mag)
        'UserControl1.filesorgente_TextChanged(Nothing, Nothing)
    End Sub

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        posx -= 20
        cliente = Tbcliente.Text
        colore = Tbcolore.Text
        htesto = Tbhtesto.Text
        odp = Tbodp.Text
        note = Tbnote.Text
        quantita = Tbquantita.Text
        file_modificato = crea_pdf(file_origine, drawstate, qta_mag)
        'UserControl1.filesorgente_TextChanged(Nothing, Nothing)
    End Sub

    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        Tbcliente.Text = ""
        Tbodp.Text = ""
        Tbcolore.Text = ""
        Tbquantita.Text = ""
        Tbnote.Text = ""
        cliente = Tbcliente.Text
        colore = Tbcolore.Text
        htesto = Tbhtesto.Text
        odp = Tbodp.Text
       
        quantita = Tbquantita.Text

        file_modificato = crea_pdf(file_origine, drawstate, qta_mag)
        'UserControl1.filesorgente_TextChanged(Nothing, Nothing)
    End Sub

    Private Sub Tbhtesto_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Tbhtesto.Validated
        htesto = Tbhtesto.Text
        file_modificato = crea_pdf(file_origine, drawstate, qta_mag)
        'UserControl1.filesorgente_TextChanged(Nothing, Nothing)
    End Sub

    Shared Sub INS_MODIFICA(ByVal MODIFICA As String, ByVal FILE As String)
        modulepdf.INS_MODIFICA(MODIFICA, FILE)
    End Sub

    Shared Function LEGGI_MODIFICA(ByVal FILE As String)
        Dim MODIFICA As String
        MODIFICA = modulepdf.LEGGI_MODIFICA(FILE)
        Return MODIFICA
    End Function
End Class
